<?php
namespace Admin\Model;
use Think\Model;
class GoodsModel extends Model{

    protected $insertFields = 'goods_name,market_price,shop_price,is_on_sale,goods_desc';
    //定义验证规则
    protected $_validate = array(
        array('goods_name', 'require', '商品名称不能为空！', 1),
        array('market_price', 'currency', '市场价格必须是货币类型！', 1),
        array('shop_price', 'currency', '本店价格必须是货币类型！', 1),

    );

public function _before_insert(&$data,$option){

    $data['addtime'] = date('Y-m-d H:i:s', time());
}
}